<script type="text/javascript"><!--//--><![CDATA[//><!--

    $(document).ready(function() {

    	var id_perakitan_barang = '<?php echo $id ; ?>';

    	 //Setup Form
		$('#form_master').setupForm([			
			{ name: 'id_produk', type: 'lov', size: 'short',
				onClearButton:function(){
					$(this).setval('');
					$('#kode_jenis_barang').setval('');
					$('#nama_jenis_barang').setval('');
					$('#bandwidth').setval('');
				},
				onActionButton:function(){ 
					LOVPerakitan_xx({ onSelect:function(row){
						$('#id_produk').setval(row.id_produk);
						$('#kode_jenis_barang').setval(row.kode_jenis_barang); 
						$('#nama_jenis_barang').setval(row.nama_jenis_barang);
						$('#bandwidth').setval(row.bandwidth);
					} }); 
				}
			},
			{ name: 'kode_jenis_barang', type: 'text', size: 'medium', maxlength: 200, readonly:true },
			{ name: 'nama_jenis_barang', type: 'text', size: 'medium', maxlength: 200, readonly:true },
			{ name: 'bandwidth', type: 'text', size: 'medium', maxlength: 200, readonly:true }		
			//{ name: 'id_perakitan_barang', type: 'text', size: 'medium', maxlength: 200},
		], <?php echo json_encode($data); ?>);
		
		

		// Set Action Button
		var buttons = [{ label: 'Save', icon: 'save', onclick: function() { 
							$('#form_master').submitForm(	'/'+controller+'/ajax_post', 
							{ detail:[	{ table: 'dtl_sample2', field:['kode_produk','nama_inventori','stock','banyak','id_perakitan_barang_detail','id_inventori']}																	], 
							//onComplete : function(data){ eval('oData = '+data); loadPage('/'+controller+'/edit/?kode_penjualan='+(oData.genid!='' ? oData.genid : $('#kode_penjualan').getval())); }
							onComplete : function(data){ eval('oData = '+data); loadPage('/'+controller+'/index'); }
							}); 
						}},
					   { label: 'Close', icon: 'cancel', onclick: function() { loadPage('/'+controller+'/index'); } }];
		setAction(buttons);
		
		// Create Tab
		$('#tt').tabs({ border:false }); 

		// Focus at First Object
		$('#form_master').focusFirst();
		
		<?php
			if ($mode == 'edit') {
				?>
					$('#kode_produk').readonly();
					$('#id_produk').readonly(true);
				<?php
			}
			
		?>

		<?php
			if ($mode == 'create') {
				?>
					$('#id_perakitan_barang').setval(id_perakitan_barang);
				<?php
			}
			
		?>

		});
//--><!]]></script>
	
<div id="form_master_message" style="display:none;"></div>
<table class="tb_form" style="display:none;" cellpadding="0" cellspacing="0">
	<tr>
        <td class="label" style="width:150px">Kode ID Produk</td>
        <td><input id="id_produk" /></td>
    </tr>
	<tr>
        <td class="label" style="width:150px">Kode Produk</td>
        <td><input id="kode_jenis_barang" /><input id="id_perakitan_barang" name="id_perakitan_barang" type="hidden" value="<?php echo $data['id_perakitan_barang'] ?>" /></td>
    </tr>
    <tr>
        <td class="label">Jenis Produk</td>
        <td><input id="nama_jenis_barang" /></td>
    </tr>
    <tr>
        <td class="label">Bandwidth</td>
        <td><input id="bandwidth" /></td>
    </tr>
</table>
<div id="tt" class="easyui-tabs" style="min-height:400px;"> 
	<div title="Detail" style="overflow:auto;padding:10px;">  
    	<?php require_once('formdtl_sample2.php'); ?>
    </div>
    
</div>